package com.czh.springboot04.service.serviceimpl;

import com.czh.springboot04.entity.ConsultConti;
import com.czh.springboot04.mapper.ConsultContiMapper;
import com.czh.springboot04.service.ConsultContiService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConsultContiServiceImpl implements ConsultContiService {
    @Autowired
    private ConsultContiMapper consultcontiMapper;
    @Override
    public int insert(ConsultConti consultconti) {
        int i = consultcontiMapper.insert(consultconti);
        return i;
    }

    @Override
    public int update(ConsultConti consultconti) {
        int i = consultcontiMapper.update(consultconti);
        return i;
    }

    @Override
    public int delete(int id) {
        int i = consultcontiMapper.delete(id);
        return i;
    }

    @Override
    public PageInfo<ConsultConti> selectByPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ConsultConti> consultContis = consultcontiMapper.selectByPage();
        PageInfo<ConsultConti> pageInfo = new PageInfo<>(consultContis);
        return pageInfo;
    }
    public ConsultConti selectById(int id){
        return consultcontiMapper.selectById(id);
    }
    @Override
    public ConsultConti selectByConId(int conId) {
        return consultcontiMapper.selectByConId(conId);
    }
    @Override
    public List<ConsultConti> selectAll() {
        return consultcontiMapper.selectAll();
    }
}
